package com.compass.doctor.ui.patient.adapter

import android.content.Context
import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.recyclerview.widget.LinearLayoutManager
import com.compass.doctor.databinding.LayoutNewPatientItemBinding
import com.compass.doctor.ui.patient.PatientDetailsActivity
import com.compass.framework.adapter.BaseBindViewHolder
import com.compass.framework.adapter.BaseRecyclerViewAdapter
import com.compass.framework.model.DrugTabItem
import com.compass.framework.model.NewPatientWarp

/**
 * Description： 新的患者adapter
 * Date:2023/12/14 13:35
 */
class NewPatientAdapter(private var mContext: Context) : BaseRecyclerViewAdapter<NewPatientWarp, LayoutNewPatientItemBinding>() {

    lateinit var mAdapter: NewPatientChildrenAdapter

    override fun getViewBinding(
        layoutInflater: LayoutInflater,
        parent: ViewGroup,
        viewType: Int
    ): LayoutNewPatientItemBinding {
        return LayoutNewPatientItemBinding.inflate(layoutInflater, parent, false)
    }


    override fun onBindDefViewHolder(
        holder: BaseBindViewHolder<LayoutNewPatientItemBinding>,
        item: NewPatientWarp?,
        position: Int
    ) {
        if (item == null) return
        holder.binding.apply {
            tvTitle.text = item.name
            mAdapter = NewPatientChildrenAdapter(mContext)
            rcyPatient.apply {
                layoutManager = LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false)

                adapter = mAdapter
            }
            mAdapter.setData(item.value)

        }
    }

}